package com.imdroid.modal;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class MatchCode {
	/**
	 * The match code
	 */
	private String matchCode;
	/**
	 * The device
	 */
	private Device device;
	/**
	 * The gps latitude
	 */
	private float latitude;
	/**
	 * The gps longtitude
	 */
	private float longtitude;
	/**
	 * The time create
	 */
	private Date createTime;
	/**
	 * The match code
	 */
	private static Map<String, MatchCode> matchCodes = new HashMap<String, MatchCode>();

	/**
	 * Get the match code
	 * 
	 * @return the matchCode
	 */
	public String getMatchCode() {
		return matchCode;
	}

	/**
	 * set the match code
	 * 
	 * @param matchCode
	 *            the matchCode to set
	 */
	public void setMatchCode(String matchCode) {
		this.matchCode = matchCode;
	}

	/**
	 * Get the device
	 * 
	 * @return the device
	 */
	public Device getDevice() {
		return device;
	}

	/**
	 * Set the device
	 * 
	 * @param device
	 *            the device to set
	 */
	public void setDevice(Device device) {
		this.device = device;
	}

	/**
	 * Get the latitude
	 * 
	 * @return the latitude
	 */
	public float getLatitude() {
		return latitude;
	}

	/**
	 * Set the latitude
	 * 
	 * @param latitude
	 *            the latitude to set
	 */
	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}

	/**
	 * Get the longtitude
	 * 
	 * @return the longtitude
	 */
	public float getLongtitude() {
		return longtitude;
	}

	/**
	 * Set the longtitude
	 * 
	 * @param longtitude
	 *            the longtitude to set
	 */
	public void setLongtitude(float longtitude) {
		this.longtitude = longtitude;
	}

	/**
	 * Get the create time
	 * 
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * Set the create time
	 * 
	 * @param createTime
	 *            the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * Add the match code
	 * 
	 * @param code
	 *            the code
	 * @param matchCode
	 *            the match code
	 */
	public static void add(String code, MatchCode matchCode) {
		matchCodes.put(code, matchCode);
	}

	/**
	 * Remove the code.
	 * 
	 * @param code
	 *            the code
	 */
	public static void remove(String code) {
		matchCodes.remove(code);
	}

	/**
	 * @param code
	 *            the match code
	 * @return the device
	 */
	public static MatchCode get(String code) {
		return matchCodes.get(code);
	}

	/**
	 * Get the match codes
	 * 
	 * @return all the match codes
	 */
	public static Map<String, MatchCode> allMatchCodes() {
		return matchCodes;
	}
}
